﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using GPSTrackingDBV2.Entities;
using GPSTrackingDBV2.Data;

#endregion

namespace GPSTrackingDBV2.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="MenuProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class MenuProviderBaseCore : EntityProviderBase<GPSTrackingDBV2.Entities.Menu, GPSTrackingDBV2.Entities.MenuKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByCompanyIdFromCompaniesByMenu
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		CompaniesByMenu table. Table Menu is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByMenu table.
		/// </summary>
		/// <param name="_companyId"></param>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdFromCompaniesByMenu(System.Int32 _companyId)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByMenu(null,_companyId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Menu objects from the datasource by CompanyID in the
		///		CompaniesByMenu table. Table Menu is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByMenu table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdFromCompaniesByMenu(System.Int32 _companyId, int start, int pageLength)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByMenu(null, _companyId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		CompaniesByMenu table. Table Menu is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByMenu table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdFromCompaniesByMenu(TransactionManager transactionManager, System.Int32 _companyId)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByMenu(transactionManager, _companyId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		CompaniesByMenu table. Table Menu is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByMenu table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_companyId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdFromCompaniesByMenu(TransactionManager transactionManager, System.Int32 _companyId,int start, int pageLength)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByMenu(transactionManager, _companyId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		CompaniesByMenu table. Table Menu is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByMenu table.
		/// </summary>
		/// <param name="_companyId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdFromCompaniesByMenu(System.Int32 _companyId,int start, int pageLength, out int count)
		{
			
			return GetByCompanyIdFromCompaniesByMenu(null, _companyId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		CompaniesByMenu table. Table Menu is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByMenu table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public abstract TList<Menu> GetByCompanyIdFromCompaniesByMenu(TransactionManager transactionManager,System.Int32 _companyId, int start, int pageLength, out int count);
		
		#endregion GetByCompanyIdFromCompaniesByMenu
		
		#region GetByAdministratorRoleIdFromMenuByAdministratorRoles
		
		/// <summary>
		///		Gets Menu objects from the datasource by AdministratorRoleID in the
		///		MenuByAdministratorRoles table. Table Menu is related to table AdministratorsRoles
		///		through the (M:N) relationship defined in the MenuByAdministratorRoles table.
		/// </summary>
		/// <param name="_administratorRoleId"></param>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByAdministratorRoleIdFromMenuByAdministratorRoles(System.Int32 _administratorRoleId)
		{
			int count = -1;
			return GetByAdministratorRoleIdFromMenuByAdministratorRoles(null,_administratorRoleId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Menu objects from the datasource by AdministratorRoleID in the
		///		MenuByAdministratorRoles table. Table Menu is related to table AdministratorsRoles
		///		through the (M:N) relationship defined in the MenuByAdministratorRoles table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_administratorRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public TList<Menu> GetByAdministratorRoleIdFromMenuByAdministratorRoles(System.Int32 _administratorRoleId, int start, int pageLength)
		{
			int count = -1;
			return GetByAdministratorRoleIdFromMenuByAdministratorRoles(null, _administratorRoleId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by AdministratorRoleID in the
		///		MenuByAdministratorRoles table. Table Menu is related to table AdministratorsRoles
		///		through the (M:N) relationship defined in the MenuByAdministratorRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_administratorRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByAdministratorRoleIdFromMenuByAdministratorRoles(TransactionManager transactionManager, System.Int32 _administratorRoleId)
		{
			int count = -1;
			return GetByAdministratorRoleIdFromMenuByAdministratorRoles(transactionManager, _administratorRoleId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Menu objects from the datasource by AdministratorRoleID in the
		///		MenuByAdministratorRoles table. Table Menu is related to table AdministratorsRoles
		///		through the (M:N) relationship defined in the MenuByAdministratorRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_administratorRoleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByAdministratorRoleIdFromMenuByAdministratorRoles(TransactionManager transactionManager, System.Int32 _administratorRoleId,int start, int pageLength)
		{
			int count = -1;
			return GetByAdministratorRoleIdFromMenuByAdministratorRoles(transactionManager, _administratorRoleId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by AdministratorRoleID in the
		///		MenuByAdministratorRoles table. Table Menu is related to table AdministratorsRoles
		///		through the (M:N) relationship defined in the MenuByAdministratorRoles table.
		/// </summary>
		/// <param name="_administratorRoleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByAdministratorRoleIdFromMenuByAdministratorRoles(System.Int32 _administratorRoleId,int start, int pageLength, out int count)
		{
			
			return GetByAdministratorRoleIdFromMenuByAdministratorRoles(null, _administratorRoleId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Menu objects from the datasource by AdministratorRoleID in the
		///		MenuByAdministratorRoles table. Table Menu is related to table AdministratorsRoles
		///		through the (M:N) relationship defined in the MenuByAdministratorRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_administratorRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public abstract TList<Menu> GetByAdministratorRoleIdFromMenuByAdministratorRoles(TransactionManager transactionManager,System.Int32 _administratorRoleId, int start, int pageLength, out int count);
		
		#endregion GetByAdministratorRoleIdFromMenuByAdministratorRoles
		
		#region GetByMasterRoleIdFromMenuByMasterRoles
		
		/// <summary>
		///		Gets Menu objects from the datasource by MasterRoleID in the
		///		MenuByMasterRoles table. Table Menu is related to table MasterRoles
		///		through the (M:N) relationship defined in the MenuByMasterRoles table.
		/// </summary>
		/// <param name="_masterRoleId"></param>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByMasterRoleIdFromMenuByMasterRoles(System.Int32 _masterRoleId)
		{
			int count = -1;
			return GetByMasterRoleIdFromMenuByMasterRoles(null,_masterRoleId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Menu objects from the datasource by MasterRoleID in the
		///		MenuByMasterRoles table. Table Menu is related to table MasterRoles
		///		through the (M:N) relationship defined in the MenuByMasterRoles table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_masterRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public TList<Menu> GetByMasterRoleIdFromMenuByMasterRoles(System.Int32 _masterRoleId, int start, int pageLength)
		{
			int count = -1;
			return GetByMasterRoleIdFromMenuByMasterRoles(null, _masterRoleId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by MasterRoleID in the
		///		MenuByMasterRoles table. Table Menu is related to table MasterRoles
		///		through the (M:N) relationship defined in the MenuByMasterRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_masterRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByMasterRoleIdFromMenuByMasterRoles(TransactionManager transactionManager, System.Int32 _masterRoleId)
		{
			int count = -1;
			return GetByMasterRoleIdFromMenuByMasterRoles(transactionManager, _masterRoleId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Menu objects from the datasource by MasterRoleID in the
		///		MenuByMasterRoles table. Table Menu is related to table MasterRoles
		///		through the (M:N) relationship defined in the MenuByMasterRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_masterRoleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByMasterRoleIdFromMenuByMasterRoles(TransactionManager transactionManager, System.Int32 _masterRoleId,int start, int pageLength)
		{
			int count = -1;
			return GetByMasterRoleIdFromMenuByMasterRoles(transactionManager, _masterRoleId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by MasterRoleID in the
		///		MenuByMasterRoles table. Table Menu is related to table MasterRoles
		///		through the (M:N) relationship defined in the MenuByMasterRoles table.
		/// </summary>
		/// <param name="_masterRoleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByMasterRoleIdFromMenuByMasterRoles(System.Int32 _masterRoleId,int start, int pageLength, out int count)
		{
			
			return GetByMasterRoleIdFromMenuByMasterRoles(null, _masterRoleId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Menu objects from the datasource by MasterRoleID in the
		///		MenuByMasterRoles table. Table Menu is related to table MasterRoles
		///		through the (M:N) relationship defined in the MenuByMasterRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_masterRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public abstract TList<Menu> GetByMasterRoleIdFromMenuByMasterRoles(TransactionManager transactionManager,System.Int32 _masterRoleId, int start, int pageLength, out int count);
		
		#endregion GetByMasterRoleIdFromMenuByMasterRoles
		
		#region GetByCompanyIdUserRoleIdFromMenuByUserRoles
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		MenuByUserRoles table. Table Menu is related to table UserRoles
		///		through the (M:N) relationship defined in the MenuByUserRoles table.
		/// </summary>
		/// <param name="_companyId"></param>
		/// <param name="_userRoleId"></param>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdUserRoleIdFromMenuByUserRoles(System.Int32 _companyId, System.Int32 _userRoleId)
		{
			int count = -1;
			return GetByCompanyIdUserRoleIdFromMenuByUserRoles(null,_companyId, _userRoleId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Menu objects from the datasource by CompanyID in the
		///		MenuByUserRoles table. Table Menu is related to table UserRoles
		///		through the (M:N) relationship defined in the MenuByUserRoles table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_companyId"></param>
		/// <param name="_userRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdUserRoleIdFromMenuByUserRoles(System.Int32 _companyId, System.Int32 _userRoleId, int start, int pageLength)
		{
			int count = -1;
			return GetByCompanyIdUserRoleIdFromMenuByUserRoles(null, _companyId, _userRoleId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		MenuByUserRoles table. Table Menu is related to table UserRoles
		///		through the (M:N) relationship defined in the MenuByUserRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_companyId"></param>
		/// <param name="_userRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdUserRoleIdFromMenuByUserRoles(TransactionManager transactionManager, System.Int32 _companyId, System.Int32 _userRoleId)
		{
			int count = -1;
			return GetByCompanyIdUserRoleIdFromMenuByUserRoles(transactionManager, _companyId, _userRoleId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		MenuByUserRoles table. Table Menu is related to table UserRoles
		///		through the (M:N) relationship defined in the MenuByUserRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_companyId"></param>
		/// <param name="_userRoleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdUserRoleIdFromMenuByUserRoles(TransactionManager transactionManager, System.Int32 _companyId, System.Int32 _userRoleId,int start, int pageLength)
		{
			int count = -1;
			return GetByCompanyIdUserRoleIdFromMenuByUserRoles(transactionManager, _companyId, _userRoleId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		MenuByUserRoles table. Table Menu is related to table UserRoles
		///		through the (M:N) relationship defined in the MenuByUserRoles table.
		/// </summary>
		/// <param name="_companyId"></param>
		/// <param name="_userRoleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Menu objects.</returns>
		public TList<Menu> GetByCompanyIdUserRoleIdFromMenuByUserRoles(System.Int32 _companyId, System.Int32 _userRoleId,int start, int pageLength, out int count)
		{
			
			return GetByCompanyIdUserRoleIdFromMenuByUserRoles(null, _companyId, _userRoleId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Menu objects from the datasource by CompanyID in the
		///		MenuByUserRoles table. Table Menu is related to table UserRoles
		///		through the (M:N) relationship defined in the MenuByUserRoles table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_companyId"></param>
		/// <param name="_userRoleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Menu objects.</returns>
		public abstract TList<Menu> GetByCompanyIdUserRoleIdFromMenuByUserRoles(TransactionManager transactionManager,System.Int32 _companyId, System.Int32 _userRoleId, int start, int pageLength, out int count);
		
		#endregion GetByCompanyIdUserRoleIdFromMenuByUserRoles
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, GPSTrackingDBV2.Entities.MenuKey key)
		{
			return Delete(transactionManager, key.MenuId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_menuId">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _menuId)
		{
			return Delete(null, _menuId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuId">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _menuId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_MenuTypes key.
		///		FK_Menu_MenuTypes Description: 
		/// </summary>
		/// <param name="_menuTypeId"></param>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByMenuTypeId(System.Int32 _menuTypeId)
		{
			int count = -1;
			return GetByMenuTypeId(_menuTypeId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_MenuTypes key.
		///		FK_Menu_MenuTypes Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuTypeId"></param>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		/// <remarks></remarks>
		public TList<Menu> GetByMenuTypeId(TransactionManager transactionManager, System.Int32 _menuTypeId)
		{
			int count = -1;
			return GetByMenuTypeId(transactionManager, _menuTypeId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_MenuTypes key.
		///		FK_Menu_MenuTypes Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuTypeId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByMenuTypeId(TransactionManager transactionManager, System.Int32 _menuTypeId, int start, int pageLength)
		{
			int count = -1;
			return GetByMenuTypeId(transactionManager, _menuTypeId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_MenuTypes key.
		///		fkMenuMenuTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_menuTypeId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByMenuTypeId(System.Int32 _menuTypeId, int start, int pageLength)
		{
			int count =  -1;
			return GetByMenuTypeId(null, _menuTypeId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_MenuTypes key.
		///		fkMenuMenuTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_menuTypeId"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByMenuTypeId(System.Int32 _menuTypeId, int start, int pageLength,out int count)
		{
			return GetByMenuTypeId(null, _menuTypeId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_MenuTypes key.
		///		FK_Menu_MenuTypes Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuTypeId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public abstract TList<Menu> GetByMenuTypeId(TransactionManager transactionManager, System.Int32 _menuTypeId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_TypeModules key.
		///		FK_Menu_TypeModules Description: 
		/// </summary>
		/// <param name="_typeModuleId"></param>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByTypeModuleId(System.Int32 _typeModuleId)
		{
			int count = -1;
			return GetByTypeModuleId(_typeModuleId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_TypeModules key.
		///		FK_Menu_TypeModules Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_typeModuleId"></param>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		/// <remarks></remarks>
		public TList<Menu> GetByTypeModuleId(TransactionManager transactionManager, System.Int32 _typeModuleId)
		{
			int count = -1;
			return GetByTypeModuleId(transactionManager, _typeModuleId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_TypeModules key.
		///		FK_Menu_TypeModules Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_typeModuleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByTypeModuleId(TransactionManager transactionManager, System.Int32 _typeModuleId, int start, int pageLength)
		{
			int count = -1;
			return GetByTypeModuleId(transactionManager, _typeModuleId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_TypeModules key.
		///		fkMenuTypeModules Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_typeModuleId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByTypeModuleId(System.Int32 _typeModuleId, int start, int pageLength)
		{
			int count =  -1;
			return GetByTypeModuleId(null, _typeModuleId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_TypeModules key.
		///		fkMenuTypeModules Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_typeModuleId"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public TList<Menu> GetByTypeModuleId(System.Int32 _typeModuleId, int start, int pageLength,out int count)
		{
			return GetByTypeModuleId(null, _typeModuleId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_Menu_TypeModules key.
		///		FK_Menu_TypeModules Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_typeModuleId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of GPSTrackingDBV2.Entities.Menu objects.</returns>
		public abstract TList<Menu> GetByTypeModuleId(TransactionManager transactionManager, System.Int32 _typeModuleId, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override GPSTrackingDBV2.Entities.Menu Get(TransactionManager transactionManager, GPSTrackingDBV2.Entities.MenuKey key, int start, int pageLength)
		{
			return GetByMenuId(transactionManager, key.MenuId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_Menu index.
		/// </summary>
		/// <param name="_menuId"></param>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Menu"/> class.</returns>
		public GPSTrackingDBV2.Entities.Menu GetByMenuId(System.Int32 _menuId)
		{
			int count = -1;
			return GetByMenuId(null,_menuId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Menu index.
		/// </summary>
		/// <param name="_menuId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Menu"/> class.</returns>
		public GPSTrackingDBV2.Entities.Menu GetByMenuId(System.Int32 _menuId, int start, int pageLength)
		{
			int count = -1;
			return GetByMenuId(null, _menuId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Menu index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuId"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Menu"/> class.</returns>
		public GPSTrackingDBV2.Entities.Menu GetByMenuId(TransactionManager transactionManager, System.Int32 _menuId)
		{
			int count = -1;
			return GetByMenuId(transactionManager, _menuId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Menu index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Menu"/> class.</returns>
		public GPSTrackingDBV2.Entities.Menu GetByMenuId(TransactionManager transactionManager, System.Int32 _menuId, int start, int pageLength)
		{
			int count = -1;
			return GetByMenuId(transactionManager, _menuId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Menu index.
		/// </summary>
		/// <param name="_menuId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Menu"/> class.</returns>
		public GPSTrackingDBV2.Entities.Menu GetByMenuId(System.Int32 _menuId, int start, int pageLength, out int count)
		{
			return GetByMenuId(null, _menuId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Menu index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_menuId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Menu"/> class.</returns>
		public abstract GPSTrackingDBV2.Entities.Menu GetByMenuId(TransactionManager transactionManager, System.Int32 _menuId, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;Menu&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;Menu&gt;"/></returns>
		public static TList<Menu> Fill(IDataReader reader, TList<Menu> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				GPSTrackingDBV2.Entities.Menu c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("Menu")
					.Append("|").Append((System.Int32)reader[((int)MenuColumn.MenuId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<Menu>(
					key.ToString(), // EntityTrackingKey
					"Menu",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new GPSTrackingDBV2.Entities.Menu();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.MenuId = (System.Int32)reader[((int)MenuColumn.MenuId - 1)];
					c.OriginalMenuId = c.MenuId;
					c.Name = (System.String)reader[((int)MenuColumn.Name - 1)];
					c.Parent = (reader.IsDBNull(((int)MenuColumn.Parent - 1)))?null:(System.Int32?)reader[((int)MenuColumn.Parent - 1)];
					c.ToolTip = (reader.IsDBNull(((int)MenuColumn.ToolTip - 1)))?null:(System.String)reader[((int)MenuColumn.ToolTip - 1)];
					c.Page = (reader.IsDBNull(((int)MenuColumn.Page - 1)))?null:(System.String)reader[((int)MenuColumn.Page - 1)];
					c.IsVisibleMaster = (System.Boolean)reader[((int)MenuColumn.IsVisibleMaster - 1)];
					c.IsVisibleAdministrator = (System.Boolean)reader[((int)MenuColumn.IsVisibleAdministrator - 1)];
					c.IsVisibleUser = (System.Boolean)reader[((int)MenuColumn.IsVisibleUser - 1)];
					c.ImageUrl = (System.String)reader[((int)MenuColumn.ImageUrl - 1)];
					c.BySequence = (System.Int16)reader[((int)MenuColumn.BySequence - 1)];
					c.Width = (reader.IsDBNull(((int)MenuColumn.Width - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Width - 1)];
					c.Heigth = (reader.IsDBNull(((int)MenuColumn.Heigth - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Heigth - 1)];
					c.Positionx = (reader.IsDBNull(((int)MenuColumn.Positionx - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Positionx - 1)];
					c.Positiony = (reader.IsDBNull(((int)MenuColumn.Positiony - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Positiony - 1)];
					c.TypeModuleId = (System.Int32)reader[((int)MenuColumn.TypeModuleId - 1)];
					c.MenuTypeId = (System.Int32)reader[((int)MenuColumn.MenuTypeId - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="GPSTrackingDBV2.Entities.Menu"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="GPSTrackingDBV2.Entities.Menu"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, GPSTrackingDBV2.Entities.Menu entity)
		{
			if (!reader.Read()) return;
			
			entity.MenuId = (System.Int32)reader[((int)MenuColumn.MenuId - 1)];
			entity.OriginalMenuId = (System.Int32)reader["MenuID"];
			entity.Name = (System.String)reader[((int)MenuColumn.Name - 1)];
			entity.Parent = (reader.IsDBNull(((int)MenuColumn.Parent - 1)))?null:(System.Int32?)reader[((int)MenuColumn.Parent - 1)];
			entity.ToolTip = (reader.IsDBNull(((int)MenuColumn.ToolTip - 1)))?null:(System.String)reader[((int)MenuColumn.ToolTip - 1)];
			entity.Page = (reader.IsDBNull(((int)MenuColumn.Page - 1)))?null:(System.String)reader[((int)MenuColumn.Page - 1)];
			entity.IsVisibleMaster = (System.Boolean)reader[((int)MenuColumn.IsVisibleMaster - 1)];
			entity.IsVisibleAdministrator = (System.Boolean)reader[((int)MenuColumn.IsVisibleAdministrator - 1)];
			entity.IsVisibleUser = (System.Boolean)reader[((int)MenuColumn.IsVisibleUser - 1)];
			entity.ImageUrl = (System.String)reader[((int)MenuColumn.ImageUrl - 1)];
			entity.BySequence = (System.Int16)reader[((int)MenuColumn.BySequence - 1)];
			entity.Width = (reader.IsDBNull(((int)MenuColumn.Width - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Width - 1)];
			entity.Heigth = (reader.IsDBNull(((int)MenuColumn.Heigth - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Heigth - 1)];
			entity.Positionx = (reader.IsDBNull(((int)MenuColumn.Positionx - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Positionx - 1)];
			entity.Positiony = (reader.IsDBNull(((int)MenuColumn.Positiony - 1)))?null:(System.Int16?)reader[((int)MenuColumn.Positiony - 1)];
			entity.TypeModuleId = (System.Int32)reader[((int)MenuColumn.TypeModuleId - 1)];
			entity.MenuTypeId = (System.Int32)reader[((int)MenuColumn.MenuTypeId - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="GPSTrackingDBV2.Entities.Menu"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="GPSTrackingDBV2.Entities.Menu"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, GPSTrackingDBV2.Entities.Menu entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.MenuId = (System.Int32)dataRow["MenuID"];
			entity.OriginalMenuId = (System.Int32)dataRow["MenuID"];
			entity.Name = (System.String)dataRow["Name"];
			entity.Parent = Convert.IsDBNull(dataRow["Parent"]) ? null : (System.Int32?)dataRow["Parent"];
			entity.ToolTip = Convert.IsDBNull(dataRow["ToolTip"]) ? null : (System.String)dataRow["ToolTip"];
			entity.Page = Convert.IsDBNull(dataRow["Page"]) ? null : (System.String)dataRow["Page"];
			entity.IsVisibleMaster = (System.Boolean)dataRow["IsVisibleMaster"];
			entity.IsVisibleAdministrator = (System.Boolean)dataRow["IsVisibleAdministrator"];
			entity.IsVisibleUser = (System.Boolean)dataRow["IsVisibleUser"];
			entity.ImageUrl = (System.String)dataRow["ImageUrl"];
			entity.BySequence = (System.Int16)dataRow["BySequence"];
			entity.Width = Convert.IsDBNull(dataRow["Width"]) ? null : (System.Int16?)dataRow["Width"];
			entity.Heigth = Convert.IsDBNull(dataRow["Heigth"]) ? null : (System.Int16?)dataRow["Heigth"];
			entity.Positionx = Convert.IsDBNull(dataRow["PositionX"]) ? null : (System.Int16?)dataRow["PositionX"];
			entity.Positiony = Convert.IsDBNull(dataRow["PositionY"]) ? null : (System.Int16?)dataRow["PositionY"];
			entity.TypeModuleId = (System.Int32)dataRow["TypeModuleId"];
			entity.MenuTypeId = (System.Int32)dataRow["MenuTypeId"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="GPSTrackingDBV2.Entities.Menu"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">GPSTrackingDBV2.Entities.Menu Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, GPSTrackingDBV2.Entities.Menu entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region MenuTypeIdSource	
			if (CanDeepLoad(entity, "MenuTypes|MenuTypeIdSource", deepLoadType, innerList) 
				&& entity.MenuTypeIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.MenuTypeId;
				MenuTypes tmpEntity = EntityManager.LocateEntity<MenuTypes>(EntityLocator.ConstructKeyFromPkItems(typeof(MenuTypes), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.MenuTypeIdSource = tmpEntity;
				else
					entity.MenuTypeIdSource = DataRepository.MenuTypesProvider.GetByMenuTypeId(transactionManager, entity.MenuTypeId);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'MenuTypeIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.MenuTypeIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.MenuTypesProvider.DeepLoad(transactionManager, entity.MenuTypeIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion MenuTypeIdSource

			#region TypeModuleIdSource	
			if (CanDeepLoad(entity, "TypeModules|TypeModuleIdSource", deepLoadType, innerList) 
				&& entity.TypeModuleIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.TypeModuleId;
				TypeModules tmpEntity = EntityManager.LocateEntity<TypeModules>(EntityLocator.ConstructKeyFromPkItems(typeof(TypeModules), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.TypeModuleIdSource = tmpEntity;
				else
					entity.TypeModuleIdSource = DataRepository.TypeModulesProvider.GetByTypeModuleId(transactionManager, entity.TypeModuleId);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'TypeModuleIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.TypeModuleIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.TypeModulesProvider.DeepLoad(transactionManager, entity.TypeModuleIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion TypeModuleIdSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByMenuId methods when available
			
			#region CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<UserRoles>|CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles", deepLoadType, innerList))
			{
				entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles = DataRepository.UserRolesProvider.GetByMenuIdFromMenuByUserRoles(transactionManager, entity.MenuId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles != null)
				{
					deepHandles.Add("CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< UserRoles >) DataRepository.UserRolesProvider.DeepLoad,
						new object[] { transactionManager, entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<MasterRoles>|MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles", deepLoadType, innerList))
			{
				entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles = DataRepository.MasterRolesProvider.GetByMenuIdFromMenuByMasterRoles(transactionManager, entity.MenuId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles != null)
				{
					deepHandles.Add("MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< MasterRoles >) DataRepository.MasterRolesProvider.DeepLoad,
						new object[] { transactionManager, entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region MenuByUserRolesCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<MenuByUserRoles>|MenuByUserRolesCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'MenuByUserRolesCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.MenuByUserRolesCollection = DataRepository.MenuByUserRolesProvider.GetByMenuId(transactionManager, entity.MenuId);

				if (deep && entity.MenuByUserRolesCollection.Count > 0)
				{
					deepHandles.Add("MenuByUserRolesCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<MenuByUserRoles>) DataRepository.MenuByUserRolesProvider.DeepLoad,
						new object[] { transactionManager, entity.MenuByUserRolesCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region MenuByAdministratorRolesCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<MenuByAdministratorRoles>|MenuByAdministratorRolesCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'MenuByAdministratorRolesCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.MenuByAdministratorRolesCollection = DataRepository.MenuByAdministratorRolesProvider.GetByMenuId(transactionManager, entity.MenuId);

				if (deep && entity.MenuByAdministratorRolesCollection.Count > 0)
				{
					deepHandles.Add("MenuByAdministratorRolesCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<MenuByAdministratorRoles>) DataRepository.MenuByAdministratorRolesProvider.DeepLoad,
						new object[] { transactionManager, entity.MenuByAdministratorRolesCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region CompaniesByMenuCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<CompaniesByMenu>|CompaniesByMenuCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CompaniesByMenuCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.CompaniesByMenuCollection = DataRepository.CompaniesByMenuProvider.GetByMenuId(transactionManager, entity.MenuId);

				if (deep && entity.CompaniesByMenuCollection.Count > 0)
				{
					deepHandles.Add("CompaniesByMenuCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<CompaniesByMenu>) DataRepository.CompaniesByMenuProvider.DeepLoad,
						new object[] { transactionManager, entity.CompaniesByMenuCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region MenuByMasterRolesCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<MenuByMasterRoles>|MenuByMasterRolesCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'MenuByMasterRolesCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.MenuByMasterRolesCollection = DataRepository.MenuByMasterRolesProvider.GetByMenuId(transactionManager, entity.MenuId);

				if (deep && entity.MenuByMasterRolesCollection.Count > 0)
				{
					deepHandles.Add("MenuByMasterRolesCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<MenuByMasterRoles>) DataRepository.MenuByMasterRolesProvider.DeepLoad,
						new object[] { transactionManager, entity.MenuByMasterRolesCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region CompanyIdCompaniesCollection_From_CompaniesByMenu
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<Companies>|CompanyIdCompaniesCollection_From_CompaniesByMenu", deepLoadType, innerList))
			{
				entity.CompanyIdCompaniesCollection_From_CompaniesByMenu = DataRepository.CompaniesProvider.GetByMenuIdFromCompaniesByMenu(transactionManager, entity.MenuId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CompanyIdCompaniesCollection_From_CompaniesByMenu' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.CompanyIdCompaniesCollection_From_CompaniesByMenu != null)
				{
					deepHandles.Add("CompanyIdCompaniesCollection_From_CompaniesByMenu",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< Companies >) DataRepository.CompaniesProvider.DeepLoad,
						new object[] { transactionManager, entity.CompanyIdCompaniesCollection_From_CompaniesByMenu, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<AdministratorsRoles>|AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles", deepLoadType, innerList))
			{
				entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles = DataRepository.AdministratorsRolesProvider.GetByMenuIdFromMenuByAdministratorRoles(transactionManager, entity.MenuId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles != null)
				{
					deepHandles.Add("AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< AdministratorsRoles >) DataRepository.AdministratorsRolesProvider.DeepLoad,
						new object[] { transactionManager, entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the GPSTrackingDBV2.Entities.Menu object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">GPSTrackingDBV2.Entities.Menu instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">GPSTrackingDBV2.Entities.Menu Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, GPSTrackingDBV2.Entities.Menu entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region MenuTypeIdSource
			if (CanDeepSave(entity, "MenuTypes|MenuTypeIdSource", deepSaveType, innerList) 
				&& entity.MenuTypeIdSource != null)
			{
				DataRepository.MenuTypesProvider.Save(transactionManager, entity.MenuTypeIdSource);
				entity.MenuTypeId = entity.MenuTypeIdSource.MenuTypeId;
			}
			#endregion 
			
			#region TypeModuleIdSource
			if (CanDeepSave(entity, "TypeModules|TypeModuleIdSource", deepSaveType, innerList) 
				&& entity.TypeModuleIdSource != null)
			{
				DataRepository.TypeModulesProvider.Save(transactionManager, entity.TypeModuleIdSource);
				entity.TypeModuleId = entity.TypeModuleIdSource.TypeModuleId;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();

			#region CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles>
			if (CanDeepSave(entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles, "List<UserRoles>|CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles", deepSaveType, innerList))
			{
				if (entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles.Count > 0 || entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles.DeletedItems.Count > 0)
				{
					DataRepository.UserRolesProvider.Save(transactionManager, entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles); 
					deepHandles.Add("CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<UserRoles>) DataRepository.UserRolesProvider.DeepSave,
						new object[] { transactionManager, entity.CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles>
			if (CanDeepSave(entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles, "List<MasterRoles>|MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles", deepSaveType, innerList))
			{
				if (entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles.Count > 0 || entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles.DeletedItems.Count > 0)
				{
					DataRepository.MasterRolesProvider.Save(transactionManager, entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles); 
					deepHandles.Add("MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<MasterRoles>) DataRepository.MasterRolesProvider.DeepSave,
						new object[] { transactionManager, entity.MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region CompanyIdCompaniesCollection_From_CompaniesByMenu>
			if (CanDeepSave(entity.CompanyIdCompaniesCollection_From_CompaniesByMenu, "List<Companies>|CompanyIdCompaniesCollection_From_CompaniesByMenu", deepSaveType, innerList))
			{
				if (entity.CompanyIdCompaniesCollection_From_CompaniesByMenu.Count > 0 || entity.CompanyIdCompaniesCollection_From_CompaniesByMenu.DeletedItems.Count > 0)
				{
					DataRepository.CompaniesProvider.Save(transactionManager, entity.CompanyIdCompaniesCollection_From_CompaniesByMenu); 
					deepHandles.Add("CompanyIdCompaniesCollection_From_CompaniesByMenu",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<Companies>) DataRepository.CompaniesProvider.DeepSave,
						new object[] { transactionManager, entity.CompanyIdCompaniesCollection_From_CompaniesByMenu, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles>
			if (CanDeepSave(entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles, "List<AdministratorsRoles>|AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles", deepSaveType, innerList))
			{
				if (entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles.Count > 0 || entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles.DeletedItems.Count > 0)
				{
					DataRepository.AdministratorsRolesProvider.Save(transactionManager, entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles); 
					deepHandles.Add("AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<AdministratorsRoles>) DataRepository.AdministratorsRolesProvider.DeepSave,
						new object[] { transactionManager, entity.AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 
	
			#region List<MenuByUserRoles>
				if (CanDeepSave(entity.MenuByUserRolesCollection, "List<MenuByUserRoles>|MenuByUserRolesCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(MenuByUserRoles child in entity.MenuByUserRolesCollection)
					{
						if(child.MenuIdSource != null)
						{
								child.MenuId = child.MenuIdSource.MenuId;
						}

						if(child.CompanyIdUserRoleIdSource != null)
						{
								child.CompanyId = child.CompanyIdUserRoleIdSource.CompanyId;
								child.UserRoleId = child.CompanyIdUserRoleIdSource.UserRolesId;
						}

					}

					if (entity.MenuByUserRolesCollection.Count > 0 || entity.MenuByUserRolesCollection.DeletedItems.Count > 0)
					{
						//DataRepository.MenuByUserRolesProvider.Save(transactionManager, entity.MenuByUserRolesCollection);
						
						deepHandles.Add("MenuByUserRolesCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< MenuByUserRoles >) DataRepository.MenuByUserRolesProvider.DeepSave,
							new object[] { transactionManager, entity.MenuByUserRolesCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<MenuByAdministratorRoles>
				if (CanDeepSave(entity.MenuByAdministratorRolesCollection, "List<MenuByAdministratorRoles>|MenuByAdministratorRolesCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(MenuByAdministratorRoles child in entity.MenuByAdministratorRolesCollection)
					{
						if(child.MenuIdSource != null)
						{
								child.MenuId = child.MenuIdSource.MenuId;
						}

						if(child.AdministratorRoleIdSource != null)
						{
								child.AdministratorRoleId = child.AdministratorRoleIdSource.AdministratorRoleId;
						}

					}

					if (entity.MenuByAdministratorRolesCollection.Count > 0 || entity.MenuByAdministratorRolesCollection.DeletedItems.Count > 0)
					{
						//DataRepository.MenuByAdministratorRolesProvider.Save(transactionManager, entity.MenuByAdministratorRolesCollection);
						
						deepHandles.Add("MenuByAdministratorRolesCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< MenuByAdministratorRoles >) DataRepository.MenuByAdministratorRolesProvider.DeepSave,
							new object[] { transactionManager, entity.MenuByAdministratorRolesCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<CompaniesByMenu>
				if (CanDeepSave(entity.CompaniesByMenuCollection, "List<CompaniesByMenu>|CompaniesByMenuCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(CompaniesByMenu child in entity.CompaniesByMenuCollection)
					{
						if(child.MenuIdSource != null)
						{
								child.MenuId = child.MenuIdSource.MenuId;
						}

						if(child.CompanyIdSource != null)
						{
								child.CompanyId = child.CompanyIdSource.CompanyId;
						}

					}

					if (entity.CompaniesByMenuCollection.Count > 0 || entity.CompaniesByMenuCollection.DeletedItems.Count > 0)
					{
						//DataRepository.CompaniesByMenuProvider.Save(transactionManager, entity.CompaniesByMenuCollection);
						
						deepHandles.Add("CompaniesByMenuCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< CompaniesByMenu >) DataRepository.CompaniesByMenuProvider.DeepSave,
							new object[] { transactionManager, entity.CompaniesByMenuCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<MenuByMasterRoles>
				if (CanDeepSave(entity.MenuByMasterRolesCollection, "List<MenuByMasterRoles>|MenuByMasterRolesCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(MenuByMasterRoles child in entity.MenuByMasterRolesCollection)
					{
						if(child.MenuIdSource != null)
						{
								child.MenuId = child.MenuIdSource.MenuId;
						}

						if(child.MasterRoleIdSource != null)
						{
								child.MasterRoleId = child.MasterRoleIdSource.MasterRoleId;
						}

					}

					if (entity.MenuByMasterRolesCollection.Count > 0 || entity.MenuByMasterRolesCollection.DeletedItems.Count > 0)
					{
						//DataRepository.MenuByMasterRolesProvider.Save(transactionManager, entity.MenuByMasterRolesCollection);
						
						deepHandles.Add("MenuByMasterRolesCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< MenuByMasterRoles >) DataRepository.MenuByMasterRolesProvider.DeepSave,
							new object[] { transactionManager, entity.MenuByMasterRolesCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region MenuChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>GPSTrackingDBV2.Entities.Menu</c>
	///</summary>
	public enum MenuChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>MenuTypes</c> at MenuTypeIdSource
		///</summary>
		[ChildEntityType(typeof(MenuTypes))]
		MenuTypes,
			
		///<summary>
		/// Composite Property for <c>TypeModules</c> at TypeModuleIdSource
		///</summary>
		[ChildEntityType(typeof(TypeModules))]
		TypeModules,
	
		///<summary>
		/// Collection of <c>Menu</c> as ManyToMany for UserRolesCollection_From_MenuByUserRoles
		///</summary>
		[ChildEntityType(typeof(TList<UserRoles>))]
		CompanyIdUserRoleIdUserRolesCollection_From_MenuByUserRoles,

		///<summary>
		/// Collection of <c>Menu</c> as ManyToMany for MasterRolesCollection_From_MenuByMasterRoles
		///</summary>
		[ChildEntityType(typeof(TList<MasterRoles>))]
		MasterRoleIdMasterRolesCollection_From_MenuByMasterRoles,

		///<summary>
		/// Collection of <c>Menu</c> as OneToMany for MenuByUserRolesCollection
		///</summary>
		[ChildEntityType(typeof(TList<MenuByUserRoles>))]
		MenuByUserRolesCollection,

		///<summary>
		/// Collection of <c>Menu</c> as OneToMany for MenuByAdministratorRolesCollection
		///</summary>
		[ChildEntityType(typeof(TList<MenuByAdministratorRoles>))]
		MenuByAdministratorRolesCollection,

		///<summary>
		/// Collection of <c>Menu</c> as OneToMany for CompaniesByMenuCollection
		///</summary>
		[ChildEntityType(typeof(TList<CompaniesByMenu>))]
		CompaniesByMenuCollection,

		///<summary>
		/// Collection of <c>Menu</c> as OneToMany for MenuByMasterRolesCollection
		///</summary>
		[ChildEntityType(typeof(TList<MenuByMasterRoles>))]
		MenuByMasterRolesCollection,

		///<summary>
		/// Collection of <c>Menu</c> as ManyToMany for CompaniesCollection_From_CompaniesByMenu
		///</summary>
		[ChildEntityType(typeof(TList<Companies>))]
		CompanyIdCompaniesCollection_From_CompaniesByMenu,

		///<summary>
		/// Collection of <c>Menu</c> as ManyToMany for AdministratorsRolesCollection_From_MenuByAdministratorRoles
		///</summary>
		[ChildEntityType(typeof(TList<AdministratorsRoles>))]
		AdministratorRoleIdAdministratorsRolesCollection_From_MenuByAdministratorRoles,
	}
	
	#endregion MenuChildEntityTypes
	
	#region MenuFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;MenuColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Menu"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class MenuFilterBuilder : SqlFilterBuilder<MenuColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the MenuFilterBuilder class.
		/// </summary>
		public MenuFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the MenuFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public MenuFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the MenuFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public MenuFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion MenuFilterBuilder
	
	#region MenuParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;MenuColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Menu"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class MenuParameterBuilder : ParameterizedSqlFilterBuilder<MenuColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the MenuParameterBuilder class.
		/// </summary>
		public MenuParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the MenuParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public MenuParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the MenuParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public MenuParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion MenuParameterBuilder
	
	#region MenuSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;MenuColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Menu"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class MenuSortBuilder : SqlSortBuilder<MenuColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the MenuSqlSortBuilder class.
		/// </summary>
		public MenuSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion MenuSortBuilder
	
} // end namespace
